package com.star.book.controller.system;

import com.star.book.entity.BookInfo;
import com.star.book.entity.User;
import com.star.book.service.IBookInfoService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.ui.Model;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestParam;

import java.awt.print.Book;
import java.util.List;
import java.util.Map;

/**
 * 小说书籍信息
 * */
@Controller
public class SysBookInfoController {
    @Autowired
    private IBookInfoService bookInfoService;

    @GetMapping("/sys/bookInfo")
    public String bookInfo(Model m, @RequestParam Integer id){
        User user = SysUserInfo.loginInfo();
        m.addAttribute("user",user);
        Map<String, Object> stringObjectMap = bookInfoService.bookInfo(id);
        Integer page = (Integer)stringObjectMap.get("page");
        m.addAttribute("page",page);
        List<BookInfo> bookInfoByPage = (List<BookInfo>)stringObjectMap.get("BookInfoByPage");
        m.addAttribute("bookInfo",bookInfoByPage);
        return "system/bookInfo";
    }
}
